#include "pointcloud_tools.h"
#include "point_display.h"
#include <iostream>
#include "point_common.h"

using namespace  pointcloud_tools;

// Only generate the weight instructions offline
int main(int argc, char** argv) {
    Pointcloud_utils ptu;
    ptu.DDR_BASE_ADDR = 0x95000000;
    std::vector<LayerConfig> layer_configs;
    /////////////////////////////////////
    // layer1                          //
    // SUBCONV: ICH = 4, OCH = 32      //
    /////////////////////////////////////
    LayerConfig layer1;
    layer1.cfg_inch_loop_num = 0;
    layer1.cfg_core_enable = 15; // 32 output channels
    layer1.cfg_shift_num = 8;
    layer1.BASE_WT_ADDR = ptu.DDR_BASE_ADDR + 0x000a00000;
    // size_t dlen1 = pointcloud_tools::readBinToVec(layer1.wt_data, "../data/second_sample/weight/conv1_weight_packed_pad.bin");
    // assert(dlen1 > 0);
    layer_configs.push_back(layer1);
    //////////////////////////////////////
    // layer2                           //
    // SubConv: ich = 32, och = 8       //
    //////////////////////////////////////
    LayerConfig layer2;
    layer2.cfg_inch_loop_num = 3;
    layer2.cfg_core_enable = 1;
    layer2.cfg_shift_num = 8;    
    layer2.BASE_WT_ADDR = ptu.DDR_BASE_ADDR + 0x000c00000;
    // size_t dlen2 = pointcloud_tools::readBinToVec(layer2.wt_data, "../data/second_sample/weight/conv2_weight_packed_pad.bin");
    // assert(dlen2 > 0);
    layer_configs.push_back(layer2);

    for (int i = 0; i < layer_configs.size(); i++) {
        LayerConfig layer_cfg = layer_configs[i];
        ptu.layer_config = layer_cfg;
        // ptu.layer_config.wt_data = layer_cfg.wt_data;
        // ptu.layer_config.DMA_WT_NUM = layer_cfg.wt_data.size() / sizeof(uint64_t);
        ptu.layer_config.BASE_WT_ADDR = layer_cfg.BASE_WT_ADDR;
        ptu.wt_inst_generator();
        // ptu.inst_dump(i+1);
        ptu.wt_inst_dump(i+1); // DUMPED TO FILEPATH: "./Runfiles/inst_weight.bin"
    }
}


  



